﻿Public Class clsJlCheck

    Public Function insert(en As entityJLCheck) As Integer
        Dim sql As String = String.Empty
        Dim rtn As Integer
        sql &= "INSERT INTO sf.b_yf_jl_check( factory_id , date_prod , date_dj, jl_type , lh_t10 , "
        sql &= "lh_t90 , lh_ml , lh_mh , yd1 , yd2 , yd3 , "
        sql &= "jl_md , check_result, note, oper, update_time) "
        sql &= "VALUES ( ?, ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , (SELECT CURRENT_TIMESTAMP(6)))"
        With en
            rtn = DBacs.ExecuteUpdateSql(sql, -1, .factory_id, .date_prod, .date_dj, .jl_type, .lh_t10,
                                         .lh_t90, .lh_ml, .lh_mh, .yd1, .yd2, .yd3,
                                         .jl_md, .check_result, .note, .oper)
        End With
        Return rtn
    End Function

    Public Function update(en As entityJLCheck) As Integer
        Dim sql As String = String.Empty
        Dim rtn As Integer
        sql &= " UPDATE sf.b_yf_jl_check SET date_prod = ? , date_dj = ? , jl_type = ? , lh_t10 = ? "
        sql &= " , lh_t90 = ? , lh_ml = ?, lh_mh = ?, yd1 = ?, yd2 = ?, yd3 = ? "
        sql &= " , jl_md = ?, check_result = ?, note = ?, update_time = (SELECT CURRENT_TIMESTAMP(6))"
        sql &= " WHERE sys_id = ? "
        With en
            rtn = DBacs.ExecuteUpdateSql(sql, -1, .date_prod, .date_dj, .jl_type, .lh_t10,
                                         .lh_t90, .lh_ml, .lh_mh, .yd1, .yd2, .yd3,
                                         .jl_md, .check_result, .note, .sys_id)
        End With
        Return rtn
    End Function

    Public Function selectBySysid(_sysid As String) As DataTable
        Dim szSql As String = "select * from sf.b_yf_jl_check where factory_id=? and sys_id=?"
        Return DBacs.ExecuteSql(szSql, -1, "TS", _sysid)
    End Function

    Public Function getList(startTime As String, endTime As String) As DataTable
        Dim szSql As String = ""
        szSql &= " select * from sf.b_yf_jl_check "
        szSql &= " where 1=1 "
        If startTime <> "" Then
            szSql &= " and update_time >= '" + startTime + "'"
        End If
        If endTime <> "" Then
            szSql &= " and update_time <= '" + endTime + "'"
        End If
        Return DBacs.ExecuteSql(szSql, -1)
    End Function

End Class
